package vh.android.multiconnector.quiz.ui.fragments;

import vh.android.multiconnector.quiz.R;
import vh.android.multiconnector.quiz.models.GamePlayer;
import vh.android.multiconnector.quiz.ui.adapters.PlayerAdapter;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

public class PlayerListFragment extends Fragment {

	private PlayerAdapter mAdapter;
	private GamePlayer[] mPlayers = new GamePlayer[] {};

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return inflater.inflate(R.layout.fragment_players, null);
	}

	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		ListView lvPlayers = (ListView) view.findViewById(R.id.lvPlayers);
		mAdapter = new PlayerAdapter(getActivity());
		lvPlayers.setAdapter(mAdapter);
		// TODO fill mPlayers
		mAdapter.addAll(mPlayers);
		super.onViewCreated(view, savedInstanceState);
	}
}
